import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Component({
  selector: 'app-p3',
  templateUrl: './p3.component.html',
  styleUrls: ['./p3.component.css']
})
export class P3Component implements OnInit {
  public products:object[];
  public proUrl="http://goodest.com.cn:8080/opple/rest/products";
  constructor(private http:HttpClient) { 

    
  }
   getProductsData(){
        this.http.get(this.proUrl).subscribe((response:any)=>{
          console.log(response);
          this.products=response.data;
        });
  }
  ngOnInit(): void {
        //读取服务器上的API接口，获取数据
    this.getProductsData();
  }

}
